package com.qqonline.broadcast;

import com.qqonline.mpf.MainActivity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 
 * @author fengcheng.ye
 *
 */
public class BootupReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED") || intent.getData().getEncodedSchemeSpecificPart().equals("com.qqonline.mpf")) {  
			 try {
				 Thread.sleep(1000);
			 } catch (InterruptedException e) {
			 // TODO Auto-generated catch block
				 e.printStackTrace();
			 }
			 
			 Intent i = new Intent(context, MainActivity.class);
			 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			 context.startActivity(i);
		 }
//		 else{
//				String packageName = intent.getDataString().substring(8);      
//		        System.out.println("---------------" + packageName);   
//		        if (packageName.equals("com.qqonline.mpf")) {
//		        	try {
//		   			 Thread.sleep(3000);
//		   		 } catch (InterruptedException e) {
//		   		 // TODO Auto-generated catch block
//		   			 e.printStackTrace();
//		   		 }
//		   		 Intent i = new Intent(context, MainActivity.class);
//		   		 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//		   		 context.startActivity(i);
//				}
//		 }
		
		 
	}

}
